package com.aabte.auth.event.infrastructure.persistence;

import com.aabte.auth.event.model.StoredEvent;
import com.aabte.auth.event.repository.StoredEventRepository;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.UUID;

@Component
public class StoredEventRepositoryHibernate implements StoredEventRepository {

    @Resource
    private StoredEventDAO storedEventDAO;

    @Override
    public void store(StoredEvent event) {
        storedEventDAO.save(event);
    }

    @Override
    public String nextEventId() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }
}
